
***************************************************************************
* Are Consumers' Spending Decisions in Line With an Euler Equation?
* Lena Dräger and Giang Nghiem
* February 2020
**************************************************************************
* This do-file performs the summary statistics and estimations using the PHF survey
* Online Appendix
**************************************************************************

clear
cd "C:\Users\nghiemgiang\Dropbox\Paper Euler equation\PHF_Estimation"

use "PHF_Analysis_W1_W2.dta", clear

*Table A3: Summary Statistics of Quantitative Inflation and Interest Rate Expectations


foreach var of varlist  inf_quan  rate_quan{

tabstat `var', stat(mean median sd min max n) save
matrix out_`var' = r(StatTotal)'

foreach i of varlist  male fem age_y age_ml age_mh age_o edu_l edu_mh edu_h inc_refer_q1 inc_refer_q2 inc_refer_q3 inc_refer_q4 {  
tabstat `var'  if `i'==1, stat(mean median sd min max n) save
matrix out_`var' = out_`var'\r(StatTotal)'
}

mat rownames out_`var'  =  All Male Female -25 26-45 46-65 66+ Low_Education Medium_Education High_Education 0-25\%_Income 25-50\%_Income 50-75\%_Income 75-100\%_Income 
outtable using stat_`var'_demogr_PHFwave2, mat(out_`var') center replace caption("Summary Statistics `var'") nobox f(%12.2fc %12.2fc %12.2fc %12.2fc %12.0fc) clabel(descstat)
}

*Estimations
*Table A4: Consumption Euler Equation, the PHF Survey

global demo  male age age2 linc_refer edu_mh edu_h full_time part_time mini_job retire risk_taker

qui: oprobit cons_past save_exp inf_qual inc_exp tax_qual $demo wave  [pw=exhoch_hh] if impid==1, vce(cluster hhid) 
estpost margins, dydx(*) predict(outcome(3)) atmean

qui: oprobit cons_past save_exp rate_qual inf_qual inc_exp tax_qual $demo  [pw=exhoch_hh] if wave==2 & impid==1, vce(cluster p_nr) 
estpost margins, dydx(*) predict(outcome(3)) atmean

qui: oprobit cons_past save_exp rate_qual inf_quan inc_exp tax_qual $demo  [pw=exhoch_hh] if wave==2 & impid==1, vce(cluster p_nr) 
estpost margins, dydx(*) predict(outcome(3)) atmean

qui: oprobit cons_past save_exp rate_quan inf_quan inc_exp tax_qual $demo  [pw=exhoch_hh] if wave==2 & impid==1, vce(cluster p_nr) 
estpost margins, dydx(*) predict(outcome(3)) atmean
